{include file="public/header" /}
<div class="page">
        <form id="form" method="post" name="form1">
            <input type="hidden" name="id" value="{$array.id}" id="id"/>
            <table class="ds-default-table">
                <tbody>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_status}:</label></td>
                    <td class="vatop rowform">
<!--                        <input type="radio" value="0" name="status" {if $array.status == 0}checked {/if}>{$Think.lang.storework_add_status_daishenhe}-->
                        <input type="radio" value="1" name="status" {if $array.status == 1}checked {/if}>
                        <label style="margin-right: 15px;">{$Think.lang.storework_add_status_on}</label>
                        <input type="radio" value="2" name="status" {if $array.status == 2}checked {/if}>{$Think.lang.storework_add_status_off}
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
<!--                     class="validation"-->
                    <td class="required w120"><label>{$Think.lang.storework_add_fail_reason}:</label></td>
                    <td class="vatop rowform">
                       <input type="text" name="fail_reason" style="width: 260px;height: 55px;"/>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                </tbody>
                <tfoot>
                <tr class="tfoot">
                    <td colspan="15" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
                </tr>
                </tfoot>
            </table>
        </form>
    </div>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<script>
//按钮先执行验证再提交表
    $(document).ready(function () {
        $("#form").validate({
            errorPlacement: function (error,element) {
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules:{
                name:{
                    required:true,
                    minlength:4,
                    maxlength:8,
                    remote:{
                        url:ADMINSITEURL+'/Storework/ajax.html?branch=check_work_name',
                        type:'get',
                        data:{
                            workname:function () {
                             return $('#name').val();
                            },
                            workid:function () {
                                return $('#id').val();
                            }
                        }
                    }
                },
                storeid:{
                    required:true,
                },
                account:{
                    required:true,
                    minlength:4,
                    maxlength:8,
                    remote:{
                        url: ADMINSITEURL+'/Storework/ajax.html?branch=check_work_account',
                        type:'get',
                        data:{
                            workaccount:function () {
                                return $('#account').val();
                            },
                            workid:function () {
                                return $('#id').val();
                            }
                        }
                    }
                },
                password:{
                    required:true,
                    minlength:6,
                    maxlength:8,
                },
               queren_password:{
                    required:true,
                    equalTo:"#password",
                },

            },
            messages:{
                name:{
                    required:'{$Think.lang.storework_add_name_required}',
                    minlength:'{$Think.lang.storework_add_name_length}',
                    maxlength:'{$Think.lang.storework_add_name_length}',
                    remote:'{$Think.lang.storework_add_name_validate_not_exists}',
                },
                storeid:{
                    required: '{$Think.lang.storework_add_storeid_required}',
                },
                account:{
                    required:'{$Think.lang.storework_add_account_required}',
                    minlength:'{$Think.lang.storework_add_account_length}',
                    maxlength:'{$Think.lang.storework_add_account_length}',
                    remote:'{$Think.lang.storework_add_account_validate_not_exists}'
                },
                password:{
                    required:'{$Think.lang.storework_add_password_required}',
                    minlength:'{$Think.lang.storework_add_password_length}',
                    maxlength:'{$Think.lang.storework_add_password_length}',
                },
                queren_password:{
                    required:'{$Think.lang.storework_add_queren_password_required}',
                    equalTo:'{$Think.lang.storework_add_queren_password_validate_repeat}',
                },
            }
        });
    });
</script>